<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - 现代化界面</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
        }
        
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
            padding: 20px;
        }
        
        .login-container {
            width: 100%;
            max-width: 420px;
        }
        
        .login-card {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 16px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
            padding: 40px;
            backdrop-filter: blur(10px);
            animation: fadeIn 0.6s ease-out;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .card-header {
            text-align: center;
            margin-bottom: 30px;
        }
        
        .card-header h2 {
            color: #333;
            margin-bottom: 8px;
            font-weight: 600;
        }
        
        .card-header p {
            color: #666;
            font-size: 14px;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        .form-group label {
            display: block;
            margin-bottom: 8px;
            color: #555;
            font-weight: 500;
            font-size: 14px;
        }
        
        .input-wrapper {
            position: relative;
        }
        
        .form-group input {
            width: 100%;
            padding: 14px 16px 14px 45px;
            border: 1px solid #e1e5e9;
            border-radius: 10px;
            font-size: 15px;
            transition: all 0.3s;
            background-color: #f9fafb;
        }
        
        .form-group input:focus {
            outline: none;
            border-color: #4a6cf7;
            box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
            background-color: #fff;
        }
        
        .input-icon {
            position: absolute;
            left: 16px;
            top: 50%;
            transform: translateY(-50%);
            color: #9ca3af;
        }
        
        .btn-login {
            width: 100%;
            padding: 14px;
            background: linear-gradient(135deg, #4a6cf7, #6a93ff);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            margin-bottom: 15px;
            box-shadow: 0 4px 10px rgba(74, 108, 247, 0.3);
        }
        
        .btn-login:hover {
            background: linear-gradient(135deg, #3a5ce5, #5a83f0);
            box-shadow: 0 6px 15px rgba(74, 108, 247, 0.4);
            transform: translateY(-2px);
        }
        
        .btn-register {
            display: block;
            text-align: center;
            padding: 12px;
            color: #4a6cf7;
            text-decoration: none;
            border: 1px solid #e1e5e9;
            border-radius: 10px;
            font-size: 15px;
            transition: all 0.3s;
            background-color: #fff;
        }
        
        .btn-register:hover {
            background-color: #f8f9fa;
            border-color: #4a6cf7;
            text-decoration: none;
            color: #3a5ce5;
            transform: translateY(-1px);
        }
        
        .card-footer {
            margin-top: 30px;
            text-align: center;
        }
        
        .divider {
            position: relative;
            text-align: center;
            margin: 25px 0;
        }
        
        .divider::before {
            content: "";
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            height: 1px;
            background: #e1e5e9;
        }
        
        .divider span {
            background: white;
            padding: 0 15px;
            color: #9ca3af;
            font-size: 13px;
        }
        
        .social-login {
            display: flex;
            justify-content: center;
            gap: 15px;
        }
        
        .social-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 44px;
            height: 44px;
            border-radius: 50%;
            color: white;
            font-size: 18px;
            transition: all 0.3s;
        }
        
        .social-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }
        
        .social-btn.google {
            background: #db4437;
        }
        
        .social-btn.github {
            background: #333;
        }
        
        .social-btn.wechat {
            background: #07c160;
        }
        
        .text-danger {
            color: #e74c3c;
            font-size: 13px;
            margin-top: 5px;
        }
        
        /* 响应式调整 */
        @media (max-width: 480px) {
            .login-card {
                padding: 30px 20px;
            }
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="login-card">
            <div class="card-header">
                <h2>欢迎回来</h2>
                <p>请登录您的账户</p>
            </div>
            
            <form action="" method="post" class="login-form">
            {% csrf_token %}
                <div class="form-group">
                    {{ form.username.label_tag }}
            {{ form.username }}
            {% if form.username.errors %}
                {% for error in form.username.errors %}
                    <p class="text-danger">{{ error }}</p>
                {% endfor %}
            {% endif %}
                    <!-- 错误提示示例 -->
                    <!-- <p class="text-danger">用户名不能为空</p> -->
                </div>

                <div class="form-group">
            {{ form.password.label_tag }}
            {{ form.password }}
            {% if form.password.errors %}
                {% for error in form.password.errors %}
                    <p class="text-danger">{{ error }}</p>
                {% endfor %}
            {% endif %}
        </div>

                <div class="form-group">
          <div class="form-group">
                    <button type="submit" class="btn-login">登录</button>
                    <a class="btn-register" href="{% url 'user:regist' %}" role="button">没有账号？去注册</a>
                </div>
        </div>
            </form>
            
            <div class="card-footer">
                <div class="divider">
                    <span>或使用以下方式登录</span>
                </div>
                <div class="social-login">
                    <a href="#" class="social-btn google">
                        <i class="fab fa-google"></i>
                    </a>
                    <a href="#" class="social-btn github">
                        <i class="fab fa-github"></i>
                    </a>
                    <a href="#" class="social-btn wechat">
                        <i class="fab fa-weixin"></i>
                    </a>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 添加简单的表单验证和交互效果
        document.addEventListener('DOMContentLoaded', function() {
            const inputs = document.querySelectorAll('input');
            
            inputs.forEach(input => {
                // 添加输入框聚焦效果
                input.addEventListener('focus', function() {
                    this.parentElement.style.transform = 'scale(1.02)';
                });
                
                input.addEventListener('blur', function() {
                    this.parentElement.style.transform = 'scale(1)';
                });
                
                // 简单的非空验证
                input.addEventListener('blur', function() {
                    if (this.value.trim() === '') {
                        this.style.borderColor = '#e74c3c';
                    } else {
                        this.style.borderColor = '#4a6cf7';
                    }
                });
            });
            
            // 登录按钮点击效果
            const loginBtn = document.querySelector('.btn-login');
            loginBtn.addEventListener('click', function(e) {
                // 在实际应用中，这里应该执行表单提交
                // 这里只是一个视觉效果
                this.style.transform = 'scale(0.98)';
                setTimeout(() => {
                    this.style.transform = '';
                }, 200);
            });
        });
    </script>
</body>
</html>